home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2004 March / PCWMAR04.iso / Software / Trial / TestTrack Pro 6 / ttprowininstall.exe / %LSMAINDIR% / LicenseServer Help / wwhelp / wwhimpl / common / scripts / browseri.js < prev    next >
Encoding:
JavaScript  |  2003-12-12  |  3.1 KB  |  124 lines

  1. // Copyright (c) 2000-2001 Quadralay Corporation.  All rights reserved.
  2. //
  3.  
  4. function  WWHBrowserInfo_Object()
  5. {
  6.   var  Agent;
  7.   var  MajorVersion = 0;
  8.  
  9.  
  10.   // Initialize values
  11.   //
  12.   this.mPlatform       = 0;      // Shorthand for Unknown
  13.   this.mBrowser        = 0;      // Shorthand for Unknown
  14.   this.mbWindowIE40    = false;  // Needed for special case handling
  15.   this.mbMacIE45       = false;  // Needed for special case handling
  16.   this.mbIEWindowsXP   = false;  // Needed for special case handling
  17.   this.mbUnescapeHREFs = true;   // Needed for special case handling
  18.   this.mbWindowsIE60   = false;  // Needed for special case handling
  19.   this.mbUnsupported   = false;
  20.  
  21.   // Get browser info
  22.   //
  23.   Agent = navigator.userAgent.toLowerCase();
  24.  
  25.   // Determine platform
  26.   //
  27.   if ((Agent.indexOf("win") != -1) ||
  28.       (Agent.indexOf("16bit") != -1))
  29.   {
  30.     this.mPlatform = 1;  // Shorthand for Windows
  31.   }
  32.   else if (Agent.indexOf("mac") != -1)
  33.   {
  34.     this.mPlatform = 2;  // Shorthand for Macintosh
  35.   }
  36.  
  37.   // Determine browser
  38.   //
  39.   if ((Agent.indexOf("mozilla") != -1) &&
  40.       (Agent.indexOf("spoofer") == -1) &&
  41.       (Agent.indexOf("compatible") == -1))
  42.   {
  43.     MajorVersion = parseInt(navigator.appVersion)
  44.  
  45.     if (MajorVersion >= 5)
  46.     {
  47.       this.mBrowser = 4;  // Shorthand for Netscape 6.0
  48.  
  49.       // Netscape 6.0 is unsupported
  50.       //
  51.       if (navigator.userAgent.indexOf("m18") != -1)
  52.       {
  53.         this.mbUnsupported = true;
  54.       }
  55.     }
  56.     else if (MajorVersion >= 4)
  57.     {
  58.       this.mBrowser = 1;  // Shorthand for Netscape
  59.     }
  60.   }
  61.   else if (Agent.indexOf("msie") != -1)
  62.   {
  63.     MajorVersion = parseInt(navigator.appVersion)
  64.     if (MajorVersion >= 4)
  65.     {
  66.       var  VersionString;
  67.  
  68.  
  69.       this.mBrowser = 2;  // Shorthand for IE
  70.  
  71.       // Additional info needed for popups
  72.       //
  73.       VersionString = navigator.appVersion.toLowerCase();
  74.       MSIEVersionString = VersionString.substring(VersionString.indexOf("msie") + 4);
  75.       Version = parseFloat(MSIEVersionString);
  76.       if ((Version >= 4.0) &&
  77.           (Version < 4.1))
  78.       {
  79.         if (this.mPlatform == 1)  // Shorthand for Windows
  80.         {
  81.           this.mbWindowsIE40 = true;
  82.         }
  83.       }
  84.       else if ((Version >= 4.5) &&
  85.                (Version < 4.6))
  86.       {
  87.         if (this.mPlatform == 2)  // Shorthand for Macintosh
  88.         {
  89.           this.mbMacIE45 = true;
  90.         }
  91.       }
  92.       else if (Version >= 6.0)
  93.       {
  94.         this.mbWindowsIE60 = true;
  95.       }
  96.     }
  97.  
  98.     // See if we are running IE under Windows XP
  99.     //
  100.     if (Agent.indexOf("windows nt ") != -1)
  101.     {
  102.       if (parseFloat(Agent.substring(Agent.indexOf("windows nt ") + 11,Agent.length)) > 5)
  103.       {
  104.         this.mbIEWindowsXP = true;
  105.       }
  106.     }
  107.   }
  108.   else if (Agent.indexOf("icab") != -1)
  109.   {
  110.     this.mBrowser = 3;  // Shorthand for iCab
  111.   }
  112.  
  113.   // Set mbUnescapeHREFs boolean
  114.   //
  115.   if ((this.mBrowser == 2) &&  // Shorthand for IE
  116.       (this.mPlatform == 1))   // Shorthand for Windows
  117.   {
  118.     if (MajorVersion >= 5)
  119.     {
  120.       this.mbUnescapeHREFs = false;
  121.     }
  122.   }
  123. }
  124.